﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeChatV3Pay.Application.Transactions.Dtos.JsApi;
using WeChatV3Pay.Core;

namespace WeChatV3Pay.Application.Transactions.Services
{
    public interface ITransactionsService
    {
        /// <summary>
        /// JSAPI下单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        /// <remarks>商户系统先调用该接口在微信支付服务后台生成预支付交易单，返回正确的预支付交易会话标识后再按Native、JSAPI、APP等不同场景生成交易串调起支付。</remarks>
        Task<JSBridgeRes> JsApiPayAsync(JsApiPayReq request);

        /// <summary>
        /// 根据系统生成的订单号查询订单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        Task<QueryTransactionRes> QueryTransactionsByIdAsync(QueryTransactionReq request);

        /// <summary>
        /// 根据商户系统内部订单号查询订单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        Task<QueryTransactionRes> QueryTransactionsByOutTradeNOAsync(QueryTransactionReq request);

        /// <summary>
        /// 关闭订单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        Task CloseTransactionsAsync([NotNull] CloseTransactionReq request);
    }
}
